using UnityEngine;
using UnityEngine.UI;
using TEngine;

namespace GameLogic
{
    [Window(UILayer.UI)]
    class TimeWindow : UIWindow
    {
        #region 脚本工具生成的代码
        private Button m_btnstarttime;
        private Button m_btn1Endtime;
        private Text m_textindx;
        protected override void ScriptGenerator()
        {
            m_btnstarttime = FindChildComponent<Button>("m_btnstarttime");
            m_btn1Endtime = FindChildComponent<Button>("m_btn1Endtime");
            m_textindx = FindChildComponent<Text>("m_textindx");
            m_btnstarttime.onClick.AddListener(OnClickstarttimeBtn);
            m_btn1Endtime.onClick.AddListener(OnClick1EndtimeBtn);
        }
        #endregion
        int Id = 0;
        int indx = 0;
        #region 事件
        private void OnClickstarttimeBtn()
        {
           Id= GameModule.Timer.AddTimer((arg) =>
            {
                m_textindx.text =indx.ToString();
                indx++;
            }, 1, true);
        }
        private void OnClick1EndtimeBtn()
        {
            GameModule.Timer.RemoveTimer(Id);
        }
        #endregion

    }
}
